Final excision of libgsystem dependency
authorColin Walters <walters@verbum.org>
Thu, 23 Jun 2016 00:12:31 +0000 (20:12 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 9 Aug 2016 15:36:09 +0000 (15:36 +0000)
Lots and lots of preparation led to this moment - when nothing
apparent changes for users!  Woo!

But seriously, having the extra dependency is a minor annoyance, and
in the big picture I think the libgsystem idea was wrong - we need to
land things in GLib, and use git submodules for API-unstable or
Linux-specific sharing.  For a lot of OSTree, the libgsystem `GFile*`
orientation was also wrong, we really want fd-relative.

Closes: #444
Approved by: jlebon

configure.ac
libglnx
packaging/ostree.spec.in
src/libotutil/ot-fs-utils.c
src/libotutil/ot-gio-utils.c
src/libotutil/ot-gio-utils.h
src/libotutil/otutil.h
src/ostree/ot-editor.c
tests/ci-install.sh
tests/test-checksum.c
tests/test-gpg-verify-result.c

index 4831bcc4adaa1310bb6f2bed43e1004041ed05aa..558a590f597c39f7dc516f5cb7a61a3bd0f0f65a 100644 (file)
@@ -54,7 +54,7 @@ AM_PATH_GLIB_2_0
 dnl When bumping the gio-unix-2.0 dependency (or glib-2.0 in general),
 dnl remember to bump GLIB_VERSION_MIN_REQUIRED and
 dnl GLIB_VERSION_MAX_ALLOWED in Makefile.am
-GIO_DEPENDENCY="gio-unix-2.0 >= 2.40.0 libgsystem >= 2015.1"
+GIO_DEPENDENCY="gio-unix-2.0 >= 2.40.0"
 PKG_CHECK_MODULES(OT_DEP_GIO_UNIX, $GIO_DEPENDENCY)
 
 dnl 5.1.0 is an arbitrary version here
diff --git a/libglnx b/libglnx
index 871617d51984604e28483d959e37fd6ce4524b0e..4ae5e3beaaa674abfabf7404ab6fafcc4ec547db 160000 (submodule)
--- a/libglnx
+++ b/libglnx
@@ -1 +1 @@
-Subproject commit 871617d51984604e28483d959e37fd6ce4524b0e
+Subproject commit 4ae5e3beaaa674abfabf7404ab6fafcc4ec547db
index 2f07f0a8df9a6f4697b1ebe2f49aababb149ef70..eff0f353b03250b8b7c5e96bd737da0530a4f161 100644 (file)
@@ -15,7 +15,6 @@ BuildRequires: gtk-doc
 # Core requirements
 BuildRequires: pkgconfig(gio-unix-2.0)
 BuildRequires: pkgconfig(libsoup-2.4)
-BuildRequires: pkgconfig(libgsystem)
 BuildRequires: pkgconfig(e2p)
 # Extras
 BuildRequires: pkgconfig(libarchive)
index 46a0405b8302de09a2b6aa4640f9efa5bb169568..4575effea17fbc3582a6004bf3d9d07ba5c2577b 100644 (file)
@@ -21,7 +21,6 @@
 #include "config.h"
 
 #include "ot-fs-utils.h"
-#include "libgsystem.h"
 #include "libglnx.h"
 #include <sys/xattr.h>
 #include <gio/gunixinputstream.h>
index a7fe74cf55b955a4105b34e8e9b49e34180ab4fe..683fa48eab120dca2895c22231f78a266867d4ef 100644 (file)
@@ -463,3 +463,39 @@ ot_file_enumerator_iterate (GFileEnumerator  *direnum,
 }
 
 #endif
+
+G_LOCK_DEFINE_STATIC (pathname_cache);
+
+/**
+ * ot_file_get_path_cached:
+ *
+ * Like g_file_get_path(), but returns a constant copy so callers
+ * don't need to free the result.
+ */
+const char *
+ot_file_get_path_cached (GFile *file)
+{
+  const char *path;
+  static GQuark _file_path_quark = 0;
+
+  if (G_UNLIKELY (_file_path_quark) == 0)
+    _file_path_quark = g_quark_from_static_string ("gsystem-file-path");
+
+  G_LOCK (pathname_cache);
+
+  path = g_object_get_qdata ((GObject*)file, _file_path_quark);
+  if (!path)
+    {
+      path = g_file_get_path (file);
+      if (path == NULL)
+        {
+          G_UNLOCK (pathname_cache);
+          return NULL;
+        }
+      g_object_set_qdata_full ((GObject*)file, _file_path_quark, (char*)path, (GDestroyNotify)g_free);
+    }
+
+  G_UNLOCK (pathname_cache);
+
+  return path;
+}
index 030acac65f480d1f965039edbed4e185d09e3c2d..0d3c45d2f9daef47141b7788f5a57a2a6be0cebd 100644 (file)
@@ -115,4 +115,14 @@ ot_file_enumerator_iterate (GFileEnumerator  *direnum,
 #endif
 #define g_file_enumerator_iterate ot_file_enumerator_iterate
 
+const char *
+ot_file_get_path_cached (GFile *file);
+
+static inline
+const char *
+gs_file_get_path_cached (GFile *file)
+{
+  return ot_file_get_path_cached (file);
+}
+
 G_END_DECLS
index 6790d8ffe6853c0f634cbbe8ef47ea881141e6ee..ec516f650128655ac9eab8e3efc537fbc71791d1 100644 (file)
@@ -23,9 +23,7 @@
 #pragma once
 
 #include <gio/gio.h>
-#include <libgsystem.h>
 #include <string.h> /* Yeah...let's just do that here. */
-#include <gsystem-local-alloc.h>
 #include <libglnx.h>
 
 #define ot_gobject_refz(o) (o ? g_object_ref (o) : o)
index 66c6e7be3bce296771b4f9e351878abf894dcdd6..bb0dd3c275a93684937eddd7024511b133de9ba1 100644 (file)
@@ -23,8 +23,8 @@
 #include "config.h"
 
 #include "libglnx.h"
+#include "otutil.h"
 #include "ot-editor.h"
-#include "libgsystem.h"
 
 #include <sys/wait.h>
 #include <string.h>
index ecd03b58110fc92678c8335cd8b57a81013400e7..4aff39e997f5d996fafb8117d7d392486303f694 100755 (executable)
@@ -31,25 +31,6 @@ case "$ci_distro" in
         ;;
 esac
 
-case "$ci_suite" in
-    (jessie)
-        # Add alexl's Debian 8 backport repository to get libgsystem
-        # TODO: remove this when libgsystem is no longer needed
-        $sudo apt-get -y update
-        $sudo apt-get -y install apt-transport-https wget
-        wget -O - https://sdk.gnome.org/apt/debian/conf/alexl.gpg.key | $sudo apt-key add -
-        echo "deb [arch=amd64] https://sdk.gnome.org/apt/debian/ jessie main" | $sudo tee /etc/apt/sources.list.d/flatpak.list
-        ;;
-
-    (trusty|xenial)
-        # Add alexl's Flatpak PPA, again to get libgsystem
-        # TODO: remove this when libgsystem is no longer needed
-        $sudo apt-get -y update
-        $sudo apt-get -y install software-properties-common
-        $sudo add-apt-repository --yes ppa:alexlarsson/flatpak
-        ;;
-esac
-
 case "$ci_distro" in
     (debian|ubuntu)
         # TODO: fetch this list from the Debian packaging git repository?
@@ -77,7 +58,6 @@ case "$ci_distro" in
             libgirepository1.0-dev \
             libglib2.0-dev \
             libgpgme11-dev \
-            libgsystem-dev \
             liblzma-dev \
             libmount-dev \
             libselinux1-dev \
index e7fd7be46447d5385ead79838804c5dc83211de4..9537804da30e5d450999f0da73578085d2e618c3 100644 (file)
@@ -21,7 +21,6 @@
 #include "config.h"
 
 #include "libglnx.h"
-#include "libgsystem.h"
 #include <glib.h>
 #include <stdlib.h>
 #include <gio/gio.h>
index e2cb48a765fd1b1eb1545d432654b7fde73d2a88..d2c1ff66acb815f93abbc1ad94a7803f877e0ff5 100644 (file)
@@ -20,8 +20,8 @@
 
 #include "config.h"
 
-#include <libgsystem.h>
 #include <gpgme.h>
+#include "libglnx.h"
 
 #include "ostree-gpg-verify-result-private.h"